<html>
	<head>
		<title>
		Lobby
		</title>
		<script>
			function goback() {
				try {
					parent.disconnectServer();
				}
				catch (err) {
					alert(err.message);
				}
			}
			function getRoomList() {
				try {
					parent.getroomlist();
					var listbox = document.getElementById("roomlistbox");
					if (parent.RoomList.length > 0) {
						//alert(parent.RoomList);						
						if (listbox!=null) {
							var arr = parent.RoomList.split(" ");
							clearChild(listbox);
							for (var i = 0; i<arr.length; i += 3) {
								var newoption = document.createElement('option');
								newoption.innerHTML = arr[i];
								listbox.appendChild(newoption);
							}
						}
					}
					else {
						clearChild(listbox);
					}
					setTimeout("getRoomList()",60000);
				}
				catch (err) {
					alert(err.message);
				}
			}
			function clearChild(ele) {
				while (ele.childNodes.length >= 1) {
					ele.removeChild(ele.firstChild);       
				} 
			}
		</script>
	<head>
	<body onload="getRoomList();">
		<form id="myform">
			<table>
				<tr>
					<td><input type="submit" value="Create" onclick="parent.createRoom();"></input></td>
				</tr>
				<tr>
					<td>
						<select size="10" width="500" id="roomlistbox">
						</select>
					</td>
				</tr>
				<tr>
					<td><input type="submit" value="Join" onclick="parent.joinRoom(document.getElementById('roomlistbox').value);"></input></td>
					<td><input type="submit" value="Back" onclick="goback();"></input></td>
				</tr>				
			</table>
		</form>
	</body>
<html>